#!/bin/bash
pacman -Sy --noconfirm --needed xfce4 xfce4-goodies gvfs gvfs-mtp
pacman -Sy --noconfirm --needed plasma-meta konsole dolphin plasma-workspace xdg-desktop-portal egl-wayland
yay -S --noconfirm masterpdfeditor-free powershell-bin
yay -S wechat-bin wps-office-cn
sudo chmod -x /opt/kingsoft/wps-office/office6/wpscloudsvr
sudo chmod -x /usr/lib/office6/wpscloudsvr

# create docker image
sudo tar -cf system.tar --exclude=/proc --exclude=/dev --exclude=/boot --exclude=/run --exclude=/sys kylin2
docker import system.tar kylin:latest

# zjd
sudo pacman -S --needed xorg-xhost squashfs-tools
下载银河麒麟镜像。
mkdir rootfs uos
sudo mount -o loop ~/Downloads/ubuntu-20.04.1-live-server-amd64.iso rootfs
sudo unsquashfs -f -d uos/ rootfs/casper/filesystem.squashfs
sudo mount --bind uos/ uos/
sudo arch-chroot uos/

sudo useradd -m g -s /bin/bash
sudo gpasswd -a g sudo
passwd g
sudo cp /etc/pam.d/su ~/build/uos/etc/pam.d/
# echo 'su g' >> ~/.bashrc
echo 'deb http://archive2.kylinos.cn/deb/kylin/production/PART-V10-SP1/custom/partner/V10-SP1 default all' | sudo tee -a /etc/apt/sources.list.d/kylin.list
sudo debootstrap --no-check-gpg unstable debian https://repo.huaweicloud.com/debian
sudo systemd-nspawn --bind=/dev/dri --bind-ro=/tmp/.X11-unix --bind=/run/user/1000 --bind-ro=/run/user/1000/bus -bD /var/lib/machines/debian
sudo systemd-nspawn --setenv=DISPLAY=:1 \
              --setenv=XAUTHORITY=~/.Xauthority \
              --bind=/tmp/.X11-unix --bind=/run/user/1000 --bind-ro=/run/user/1000/bus \
              -D /home/h/build/debian \
              --as-pid2 \
              --user g \
              firefox
apt install bash-completion sudo xfce4 xorg fonts-noto*
echo . /etc/bash_completion >> ~/.bashrc
timedatectl set-timezone Asia/Shanghai
echo 'deb https://pro-store-packages.uniontech.com/appstore eagle-pro appstore' | sudo tee -a /etc/apt/sources.list.d/uos.list
echo 'APT::Get::AllowUnauthenticated "true";
Acquire::AllowInsecureRepositories "true";' | sudo tee -a /etc/apt/apt.conf.d/99myown.conf
rm -r /etc/apt/sources.list.d/*
# sudo passwd g
# su g
sudo apt update
sudo apt upgrade
sudo apt install com.zjd.gov
# echo '/opt/apps/com.zjd.gov/files/Elevator.sh' > zjd.sh && chmod +x zjd.sh

# uos
echo '#%PAM-1.0
auth            sufficient      pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
#auth           sufficient      pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
#auth           required        pam_wheel.so use_uid
auth            required        pam_unix.so
account         required        pam_unix.so
session         required        pam_unix.so
password        include         system-auth' > /etc/pam.d/su

apt-file show $(apt-rdepends com.zjd.gov | grep -v "^ ")
depends=$(apt-rdepends com.zjd.gov | grep -v "^ ")
files=$(for i in $depends; do apt-file show $i ; done)
tar -cf depends.tar $files
